package com.zlx.mall.basic.authentication.property;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.Duration;

/**
 * @author qingke
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AuthenticationProperty {
    /**
     * 申请认证有效时间, e.g. 短信验证码有效期
     * 0 不设置缓存
     */
    @NotNull(message = "Authentication Property [applyExpireTime] must not be null")
    private Duration applyExpireTime = Duration.ZERO;

    /**
     * 申请认证间隔时间, e.g. 短信验证码获取间隔时间
     * 0 不设置缓存
     */
    @NotNull(message = "Authentication Property [applyIntervalTime] must not be null")
    private Duration applyIntervalTime = Duration.ZERO;

    /**
     * 申请认证间隔时间限制文案, e.g. 频繁获取短信验证码
     */
    @NotBlank(message = "Authentication Property [intervalLimitMessage] must not be null")
    private String intervalLimitMessage = "com.pgy.common.authentication.interval.limit.message";

    /**
     * 申请认证最大次数, e.g. 短信验证码最大获取次数
     * -1 不限制
     */
    @NotNull(message = "Authentication Property [maxPuts] must not be null")
    private Long maxPuts = -1L;

    /**
     * 申请认证次数缓存时间, e.g. 短信验证码获取次数缓存一天
     */
    @NotNull(message = "Authentication Property [putsExpireTime] must not be null")
    private Duration putsExpireTime = Duration.ZERO;

    /**
     * 申请认证最大次数限制文案, e.g. 短信验证码在一天内获取次数超过限制提示文案
     */
    @NotBlank(message = "Authentication Property [putsLimitMessage] must not be null")
    private String putsLimitMessage = "com.pgy.common.authentication.puts.limit.message";

    /**
     * 验证认证命中次数缓存时间, e.g. 短信验证码命中次数缓存一天
     */
    @NotNull(message = "Authentication Property [hitsExpireTime] must not be null")
    private Duration hitsExpireTime = Duration.ZERO;

    /**
     * 验证认证失败最大次数, e.g. 短信验证码验证失败
     * -1 不限制
     */
    @NotNull(message = "Authentication Property [maxMisses] must not be null")
    private Long maxMisses = -1L;

    /**
     * 验证认证失败次数缓存时间, e.g. 短信验证码错误次数缓存一天
     */
    @NotNull(message = "Authentication Property [missesExpireTime] must not be null")
    private Duration missesExpireTime = Duration.ZERO;

    /**
     * 验证认证失败次数限制文案, e.g. 短信验证码在一天内验证失败次数超过限制提示文案
     */
    @NotBlank(message = "Authentication Property [missesLimitMessage] must not be null")
    private String missesLimitMessage = "com.pgy.common.authentication.misses.limit.message";

    /**
     * 验证失败文案, e.g. 短信验证码验证失败
     */
    @NotBlank(message = "Authentication Property [checkErrorMessage] must not be null")
    private String checkErrorMessage = "com.pgy.common.authentication.check.error.message";
}
